﻿using System;
using System.Collections;
using System.Collections.Generic;
using PdfSdk.Pdf;

namespace PdfSdk
{
    public class PdfPrimitiveListWrapper : IList<IPdfPrimitiveWrapper>
    {
        private readonly IList _originalList;

        public PdfPrimitiveListWrapper(IList list)
        {
            _originalList = list;
        }

        public IPdfPrimitiveWrapper this[int index]
        {
            get => PdfPrimitiveHelper.GetPrimitiveWrapper(_originalList[index]);
            set => _originalList[index] = value?.OriginalObject;
        }

        public int Count => _originalList.Count;

        public bool IsReadOnly => false;

        public void Add(IPdfPrimitiveWrapper item)
        {
            throw new NotImplementedException();
        }

        public void Clear()
        {
            throw new NotImplementedException();
        }

        public bool Contains(IPdfPrimitiveWrapper item)
        {
            throw new NotImplementedException();
        }

        public void CopyTo(IPdfPrimitiveWrapper[] array, int arrayIndex)
        {
            throw new NotImplementedException();
        }

        public IEnumerator<IPdfPrimitiveWrapper> GetEnumerator()
        {
            for (int i = 0; i < Count; i++)
            {
                yield return this[i];
            }
        }

        public int IndexOf(IPdfPrimitiveWrapper item)
        {
            throw new NotImplementedException();
        }

        public void Insert(int index, IPdfPrimitiveWrapper item)
        {
            throw new NotImplementedException();
        }

        public bool Remove(IPdfPrimitiveWrapper item)
        {
            throw new NotImplementedException();
        }

        public void RemoveAt(int index)
        {
            throw new NotImplementedException();
        }

        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
    }
}
